﻿using System.Windows;
using WPFServices.ViewModels.DomainViewModel;

namespace WPFServices.Views.DomainViews
{
    public partial class AddRoleWindow : Window
    {
        public AddRoleWindow()
        {
            InitializeComponent();
            DataContext = new AddRoleViewModel();

            // 订阅ViewModel的关闭窗口事件
            if (DataContext is AddRoleViewModel viewModel)
            {
                viewModel.CloseWindow += (result) =>
                {
                    DialogResult = result;
                    Close();
                };
            }
        }
    }
}